<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script>
window.jsTestIsAsync = true;
var target;

onload = function()
{
    description('Focus can be moved around frames.');
    document.getElementsByTagName("iframe")[0].focus();
    frames[0].focus();
    setTimeout(test2, 0);
};

function test2()
{
    focus();
    target = document.getElementById('target');
    target.focus();
    shouldBeTrue('document.activeElement == target');
    shouldBe('target.selectionStart', '0');
    shouldBe('target.selectionEnd', '0');
    document.getElementById('container').outerHTML = '';
    finishJSTest();
}
</script>
</head>
<body>
<div id="container">
<input id="target"><br>
<iframe src="data:text/html,<body><input><script>document.querySelector('input').focus()</script></body>" height=40 width=200></iframe>
<br>
</div>
</body>
</html>
